﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace community
{
    public partial class familiersout : Form
    {
        public familiersout()
        {
            InitializeComponent();
        }

        private void familiersout_Load(object sender, EventArgs e)
        {
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";
            textBox5.Text = "";
            comboBox1.Text = "";
            dateTimePicker1.Text = "";
            textBox1.Text = family.datagridviewJMXM;
            textBox2.Text = family.datagridviewSQMC;
            textBox3.Text = family.datagridviewHZXM;
            textBox4.Text = family.datagridviewJMBH;
            textBox5.Text = family.datagridviewJTBH;
            textBox6.Text = family.datagridviewYHZGX;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if(comboBox1.Text=="")
            {
                MessageBox.Show("请输入成员迁出的原因", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (dateTimePicker1.Text == "")
            {
                MessageBox.Show("请输入迁出的时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (MessageBox.Show("确定成员成员", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                return;
            SqlConnection cn = new SqlConnection(SQL.conStr);
            string str = "update T_CS_INHABITANTRECORD_NEW set familycode_chr='',rehouseholder_vchr='' where inhabitantcode_chr='" +Convert.ToString( family.datagridviewJMBH)+"'";
            cn.Open();
            SqlCommand cm = new SqlCommand(str,cn);
            cm.ExecuteNonQuery();
            cn.Close();
            MessageBox.Show("家庭成员迁出成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
        }
    }
}
